#define  _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <assert.h>
#include <math.h>
// 48 - 57
int My_atoi(const char* str)
{
	assert(str);

	if (*str < 48 || *str > 57)
	{
		return 0;
	}

	char* s = str;
	int len = 0;
	while (*s && *s >=48 && *s <= 57 )
	{
		len++;
		s++;
	}

	s = str;
	int ret = 0;
	while (len--)
	{
		int num = 0;
		for (int i = 48; i <= 57; i++)
		{
			if (*s == i)
			{
				num = i - 48;
			}
		}
		ret += num*pow(10,len);

		s++;
	}

	return ret;

}
int main()
{
	char a[] = "12345";
	char b[] = "wos";
	char c[] = "234wos";
	int m = My_atoi(a);
	int n = My_atoi(b);
	int h = My_atoi(c);

	printf("%d\n", m);
	printf("%d\n", n);
	printf("%d\n",h);

	return 0;
}